package cn.ssm.service;

import cn.ssm.doman.User;
import cn.ssm.mapper.UserMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class UserServiceimpl implements UserService{
    @Autowired
    private UserMapper userMapper;
    public boolean save(User user) {
        return userMapper.save(user);
    }

    public boolean update(User user) {
        return userMapper.update(user);
    }

    public boolean delete(Integer uuid) {
        return userMapper.delete(uuid);
    }

    public User get(Integer uuid) {
        return userMapper.get(uuid);
    }

    public PageInfo<User> getAll() {
        /*设置分页*/
        PageHelper.offsetPage(1,4);
        List<User> all =userMapper.getAll();
        //将查询的数据存储到分页插件当中
        PageInfo pageInfo=new PageInfo(all);
        return pageInfo;
    }

    public User login(User user) {
        return userMapper.login(user);
    }
}
